<template>
	<view>
		<view class="content">
			<view class="login_box">
				<message-edit :showclear="showclear" type="2" @changeMsg1="changeMsg1" @changeMsg2="changeMsg2"
					:showinput="showinput"></message-edit>
				<view class="login_btn1" v-if="showclear==true&&showinput==true" @click="goNext">确定</view>
				<view class="login_btn" v-else>确定</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {changemoblie} from '@/api/personal.js'
	import messageedit from '@/pages/personal/message-edit.vue'
	export default {
		components: {
			"messageEdit": messageedit
		},
		data() {
			return {
				phone: {},
				showclear: false,
				showinput: false,
			}
		},
		methods: {
			//子子组件触发
			changeMsg1(el) {
				el != '' ? this.showclear = true : this.showclear = false
			},
			//子子组件触发
			changeMsg2(el) {
				el.captcha != '' ? this.showinput = true : this.showinput = false
				this.phone = el
			},
			//确定
			goNext() {
				changemoblie(this.phone).then(res => {
					if(res.code == 1){
						this.$msg(res.msg)
						setTimeout( () =>{
							uni.navigateBack({
								delta:2
							})
						},1000)
					}else{
						this.$msg(res.msg)
					}
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.content {
		width: 100vw;
		height: 100vh;
		background-color: #fff;
		overflow: hidden;

		.login_box {
			width: 100%;
			margin-top: 10%;
			height: 650rpx;

			.login_title {
				width: 80%;
				margin: auto;
				font-size: 44rpx;
				font-family: PingFang SC;
				font-weight: 700;
				color: #333;
			}

			.login_input_box {
				width: 80%;
				margin: 0 auto;
				margin-top: 40rpx;

				.login_input_item {
					width: 100%;
					height: 100rpx;
					display: flex;
					align-items: center;
					border-bottom: 1rpx solid #e5e5e5;
					justify-content: space-between;

					.input_box_r {
						.code_btn {
							width: 130rpx;
							height: 50rpx;
							border: 1rpx solid #ddd;
							border-radius: 6rpx;
							font-size: 22rpx;
							font-family: PingFang SC;
							font-weight: 500;
							color: #999;
							display: flex;
							justify-content: center;
							align-items: center;
						}
					}

					.input_class {
						font-size: 28rpx;
						font-family: PingFang SC;
						font-weight: 500;
						color: #999;
					}

					.clear_btn {
						width: 13px;
						height: 13px;
					}
				}
			}

			.login_btn {
				width: 80%;
				height: 88rpx;
				margin: auto;
				background: #ddd;
				border-radius: 10rpx;
				font-size: 30rpx;
				font-family: PingFang SC;
				font-weight: 500;
				color: #fff;
				display: flex;
				justify-content: center;
				align-items: center;
				margin-top: 60rpx;
			}

			.login_btn1 {
				width: 80%;
				height: 88rpx;
				margin: auto;
				background: #ffdd47;
				border-radius: 10rpx;
				font-size: 30rpx;
				font-family: PingFang SC;
				font-weight: 500;
				color: #fff;
				display: flex;
				justify-content: center;
				align-items: center;
				margin-top: 60rpx;
			}
		}
	}
</style>
